home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
B-Business
/
(c)b2.d64
/
reg'd supply.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
7KB
|
205 lines
10 POKE53280,0:POKE53281,0:PRINT"[147]DESIGNING A BASIC POWER SUPPLY"
20 PRINT
30 PRINT"WHICH DO WANT TO DESIGN"
40 PRINT
50 PRINT"1. A BASIC TRANSFORMER AND BRIDGE SUPPLY
70 [153]"2. A REG. SUPPLY ONLY
80 PRINT
90 PRINT"3. OR BOTH REG. AND BRIDGE SUPPLY
100 [133] A
110 [139] A[178]1 [167][137] 290
120 [139] A[178]2 [167][137] 140
130 [139] 1[179]A[177]3 [167][137]30
140 [143]
150 [153]"LOAD"
160 [153]"WHICH REG. WOULD YOU LIKE TO DESIGN"
170 [153]
180 [153]"A. DO YOU WANT FEEDBACK REG. WITH PROTECTION
190 PRINT
200 PRINT"B. DO YOU WANT FEEDBACK REG. ONLY
210 [153]
220 [153]"C. OVERLOAD PROTECTION W(null)ZENER TRANSISTOR
230 PRINT
240 PRINT"D. DO YOU WANT ZENER REG W[206]EXTEND TRANSISTOR
250 [153]
260 [153]"E. DO YOU WANT JUST A ZENER REG.
270 INPUT B$
280 PRINT"[147]"
290 INPUT "WHAT DO YOU WANT THE OUTPUT VOLTAGE.";VO
300 PRINT
310 INPUT "WHAT DO YOU WANT THE OUTPUT I AMPS.";IO
320 PRINT
330 INPUT"WHAT DO YOU WANT THE RIPPLE VOLTAGE.";RO
340 PRINT"[147]"
350 IF A =1 THEN GOTO 1750
360 IF A=2 THEN GOTO 380
370 IF A=3 THEN GOTO 1750
380 IF B$="A" THEN GOTO 430
390 IF B$="B" THEN GOTO 490
400 IF B$="C" THEN GOTO 1060
410 IF B$="D" THEN GOTO 1300
420 IF B$="E" THEN GOTO 1560
430 PRINT"[147]"
440 PRINT "THIS IS AN FEEDBACK REG. W[206]INPUT PROTECTION"
450 PRINT
460 R4=INT((2/(1.2*IO*.05))*100)/100:PZ=INT((.1*VO*IO)*100)/100
470 PI=INT((VO*IO*1.5)*100)/100:VZ=INT((VO+2)*100)/100:P4=INT((.2*PI)*100)/100
480 GOTO 530
490 PRINT"[147]"
500 PRINT"THIS IS AN FEEDBACK REG."
510 PRINT
520 P3=INT((VO/(IO*.05))*100)/100
530 REM
540 R3=INT((VO/(IO*.05))*100)/100:R1=INT((.01*R3)*100)/100:R2=INT(10*R3)/100
550 C2=1000:Q1=INT(VO*IO*100)/100:Q2=INT(20*Q1)/100:Q3=INT(10*Q1)/100
560 VZ=VO:V1=VO:V2=V1:V3=V1:PO=INT(VO*IO*100)/100:VI=INT((VO-3)*100)/100
570 P1=INT(VO*IO*100)/100:P2=INT(20*P1)/100:P3=INT(10*P1)/100:VI=VO*1.2:PZ=P3
580 PRINT "Q1 AND Q2 ARE PNP AND Q3 IS AN NPN"
590 IF B$="A"THEN GOTO 830
600 PRINT
610 PRINT "[163][163][163][163][207][163][163][163][207][163][163][163][207][163][163][163][205]Q1[206][163][163][163][163][207] [219]";"R1=";R1
620 PRINT " [219] [165] [165] [165] [189][206] [165] ";"R2=";R2
630 PRINT " [165] [206] [206] [163][163][207][163] [165] ";"R3=";R3
640 PRINT " [165] [205] [205] [165] [165] ";"PR1=";P1
650 PRINT " [165]R2[206] R1[206] [165] [165] ";"PR2=";P2
660 PRINT " [165] [205] [205] [165] [165] ";"PR3=";P3
670 PRINT " [165] [206] [206] [165] [165] ";"VZ=";VZ
680 PRINT " [165] [205] [205] [165] [165] ";"PZ=";PZ
690 PRINT " [165] [165] [204][164][164][164][164][186] [165] ";"VQ1=";V1
700 PRINT " [165] [165] Q2 [205] [206][163][163][165] ";"VQ2=";V2
710 PRINT " [165][160][160][160][165] [189][206] [165] ";"VQ3=";V3
720 PRINT " [206] [165] [163][208][163][163] [165] ";"PQ1=";Q1
730 PRINT " [205] [204][164][164][164][164][164][164][164][164][164][164][186] [165] ";"PQ2=";Q2
740 PRINT " R3[206] [167] [165] ";"PQ3=";Q3
750 PRINT " [205][206] Q3 [167] [206] [165] ";"VO=";VO
760 PRINT " [206][205][163][163][163][163][207][163][163][163][163][204][164][164][186][206] [165] ";"IO=";IO
770 PRINT " [205] [186][204] [167][205] [165] ";"VI=";VI
780 PRINT " [167] [213][201] C2 [167] [189] [165] ";"PI=";PI
790 PRINT " [163][163] [186][204] [163][163][163][163] "
800 PRINT " [205][205][205] [205][205][205] "
810 GOTO 2000
820 GOTO 2000
830 REM
840 PRINT "[163][163][163][163][207][163][163][163][207][163][163][163][207][163][163][163][205]Q1[206][163][163][163][163][207] [219]";"R1=";R1
850 PRINT " [219] [165] [165] [165] [189][206] [165] ";"R2=";R2
860 PRINT " [165] [206] [206] [163][163][207][163] [165] ";"R3=";R3
870 PRINT " R4[206] [205] [205] [165] [165] ";"R4=";R4
880 PRINT " [205] R2[206] R1[206] [165] [165] ";"PR1=";P1
890 PRINT " [206] [205] [205] [165] [165] ";"PR2=";P2
900 PRINT " [205] [206] [206] [165] [165] ";" PR3=";P3
910 PRINT " [206] [205] [205] [167][165] [165] ";"PR4=";P4
920 PRINT " [205] [165] [204][164][164][164][164][186][165] [165] ";"PZ=";PZ
930 PRINT "[167][207][163][163][165] [165] Q2 [205] [206][163][163][165] ";"VQ1=";V1
940 PRINT "[167][165]Z [165][160][160][160][165] [189][206] [165] ";"VQ2=";V2
950 PRINT "[176][189] [206] [165] [163][208][207][163] [165] ";"VQ3=";V3
960 PRINT "[206][205] [205] [204][164][164][164][164][164][164][164][164][164][164][186][165] [165] ";"PQ1=";Q1
970 PRINT "[208][207] [206] R3 [167] [165] ";"PQ1=";Q1
980 PRINT "[167][165] [205][206] Q3 [206] [165] ";"PQ3=";Q3
990 PRINT "[167][165] [206][205][163][163][163][208][207][163][163][163][204][164][164][164][186][206] [165] ";"VO=";VO
1000 PRINT "[167][165] [205] [186][204] [167][205] [165] ";"IO=";IO
1010 PRINT " [163][163][208] [213][201] [189] [165] ";"PI=";PI
1020 PRINT " [163][163] [186][204] [163][163][163][163] ";"VI=";VI
1030 PRINT " [205][205][205] [205][205][205] ";"VZ=";VZ
1040 GOTO 2000
1050 PRINT "IIN=";II;" PI=";PI
1060 PRINT"[147]"
1070 PRINT "OVERLOAD PROTECTION W[206]ZENER EXTEND TRANSISTOR"
1080 PRINT
1090 VI=INT((VO+1)*100)/100:IR=IO:R2=INT(1000*(VO/IO))/100:R3=INT(110/IO)/100
1100 RW=INT(IO*IO*R3*100)/100:VD=VI:ID=IO:P2=INT(VO*IO*100)/100
1110 PO=INT(VI*IO*100)/100:Q2=V1:II=INT(IO*120)/100:PI=INT(VI*II*100)/100
1120 Q2=VI
1130 PRINT
1140 PRINT " [163][163][163][163][163][208][207][163][163][163][163][205][206][205][206][205][206][205][206][163][208][207][163] [219]"; "R3=";R3
1150 PRINT " [167][165] R3 [167][165] "; "VD=";VD
1160 PRINT " [164][186][204][164] [186][204] "; "ID=";ID
1170 PRINT " [206][205] Q2 CR2 [206][205] "; "RW=";RW
1180 PRINT " [164][164][164][164][206] [189] [208][207] "; "IO=";IO
1190 PRINT " [163][163][163][163][163][163][163][163][163][163][163][207][163] ";"PO=";PO
1200 PRINT " [206] ";"R2=";R2
1210 PRINT " [205] ";"VQ2=";Q2
1220 PRINT " R2 [206] ";"PQ2=";P2
1230 PRINT " [205] ";"IIN=";II
1240 PRINT " [186][204] ";"VI=";VI
1250 PRINT " [205][205][205] ";"PI=";PI
1260 PRINT
1270 INPUT "ARE YOU READY TO GO ON";X$
1280 IF X$="Y"THEN GOTO 1290
1290 IF B$="C"THEN GOTO 1340
1300 PRINT
1310 PRINT"[147]"
1320 U=2
1330 PRINT "THIS IS A ZENER REG. SUPPLY W[206]EXTEND TRANSISTOR"
1340 PRINT
1350 IF B$="C"THEN LET VO=VI:IO=II:PO=PI
1360 VI=INT((2+VO)*100)/100:I1=INT(5*IO)/100:PO=INT(VO*IO*100)/100:PZ=.1*PO
1370 R1=INT(((.9*VO-.5)/(VO*.05))*100)/100:VZ=INT((VO-.5)*100)/100
1380 Q1=VI:II=INT(IO*120)/100:P1=INT(IO*120*VI)/100 :PI=INT(VI*II*100)/100
1390 IF U<>2THENGOTO1310
1400 PRINT " [163][163][163][163][208][207][163][163][205][160][160][174][163][163][163][163][163][163][163] [219] ";"VQ1=";Q1
1410 PRINT " [206] [205][206] Q1 ";"PQ1=";P1
1420 PRINT " [205] [163][208][207][163] ";"R1=";R1
1430 PRINT " [206] [167][165] ";"PZ=";PZ
1440 PRINT " R1 [205] [167][165] ";"VZ=";VZ
1450 PRINT " [206] [167][165] ";"VO=";VO
1460 PRINT " [205] [167][165] ";"IO=";IO
1470 PRINT " [204][164][164][164][186][165] ";"VI=";VI
1480 PRINT " [167][165] ";"II=";II
1490 PRINT " [176][189] ";"PI=";PI
1500 PRINT " Z [206][205] ";"PO=";PO
1510 PRINT " [208][207] ";"IR1=";I1
1520 PRINT " [167][165] "
1530 PRINT " [186][204] "
1540 PRINT " [205][205][205] "
1550 GOTO 2000
1560 PRINT"[147]"
1570 PRINT "THIS IS A ZENER REG."
1580 PRINT
1590 PR=INT(VO*IO*100)/100
1600 VZ=VO:PZ=VZ*IO:VI=INT(150*VZ)/100:RS=INT(((VI-VZ)*(VI-VZ)/PR)*100)/100
1610 PO=INT(VI*IO*150)/100:II=INT(IO*120)/100
1620 PI=INT(VI*II*100)/100
1630 PRINT
1640 PRINT" [163][163][163][163][205][206][205][206][205][206][205][206][205][206][163][207][163][163][163][163] [219] ";"RS=";RS
1650 PRINT" RS [165] ";"VZ=";VZ
1660 PRINT" [176][189] ";"PZ=";PZ
1670 PRINT" Z [206][205] ";"VO=";VO
1680 PRINT" [208][207] ";"VI=";VI
1690 PRINT" [186][204] ";"PO=";PO
1700 PRINT" [205][205][205] ";"PI=";PI
1710 PRINT "PR=";PR;"IIN=";II;"IO=";IO
1720 GOTO 2000
1730 PRINT
1740 PRINT "THIS IS A BASIC TRANSFORMER SUPPLY"
1750 PRINT
1760 VS=INT(100*VO/1.3)/100:TP=INT(150*VO*IO)/100:RL=INT(100*VO/IO)/100
1770 VC=INT(150*VO)/100:RS=INT(((VC-VO)/IO)*100)/100
1780 C1=INT(20000000/(RL*RS))/100
1790 PO=VO*IO:VD=2*VO:ID=IO*2:T1=VS:PI=T1*ID
1800 PRINT
1810 PRINT "[192][192][192][192][192][192][192][201][221][221][213][192][192][192][192][192][192] ";"VS=";VS
1820 PRINT " [203][221][221][202] [206][205] ";"TP=";TP
1830 PRINT " [201][221][221][213] [214] [205] ";"RL=";RL
1840 PRINT " [203][221][221][202][160][160][160][223]";" ";"[169]";"[146]";" VC=";VC
1850 PRINT " [201][221][221][213] [206] [214] ";"RS=";RS
1860 PRINT " [203][221][221][202] [167][205] [206][163][208][207] [219]";"C1=";C1
1870 PRINT " TPR1 [201][221][221][213][160][167] ";"";"[169]";"[146]";" [214] [186][204] ";"PO=";PO
1880 PRINT " [203][221][221][202][160][167] [214] [223] [213][201] ";"VD=";VD
1890 PRINT " [201][221][221][213] [167] [205][206] [167][165] ";"ID=";ID
1900 PRINT "[192][192][192][192][192][192][192][203][221][221][202][192][192][192][192][192][192] [167][165] ";"T1=";T1
1910 PRINT " [167][164][164][164][164][164][164][164][164][164][186][204][164]";"PI=";PI
1920 PRINT "VO=";VO;" IO=";IO
1930 IF A=3 THEN GOTO 1970
1940 IF C<3 OR C>3 THEN GOTO 2000
1950 TC=TI+1000
1960 IFTC>TI THENGOTO1960
1970 INPUT "ARE YOU READY TO CONTINUE ";X$
1980 IF X$="Y"THEN GOTO 380
1990 IF X$="N"THEN GOTO1970
2000 TC=TI+1000
2010 IFTC>TI THENGOTO2010
2020 INPUT "DO YOU WANT ANOTHER DESIGN";X$
2030 IF X$="Y"THENRUN
2040 IF X$="N"THEN GOTO2050
2050 REM